﻿// -------------------------------------------------------------------------
//    @FileName         :    NFPublicDefine.h
//    @Author           :    gaoyi
//    @Date             :    24-8-14
//    @Email            :    445267987@qq.com
//    @Module           :    NFPublicDefine
//
// -------------------------------------------------------------------------

#pragma once

#include "NFComm/NFCore/NFPlatform.h"

//misc
#define MAX_PKG_PER_PROC   20
#define DBSERVER_VER_MAJOR      1
#define DBSERVER_VER_MINOR      0
#define DBSERVER_VER_REV        0
#define DBSERVER_VER_BUILD      0
//value
#define ROLELOGIN_FABRICATE                 1
#define MINUTE(m)                  (60 * (m))
#define HOUR(hour)         (60 * 60 * (hour))
#define DAY(day)       (60 * 60 * 24 * (day))
//#define TRACEDETAILLOG(fmt, ...){ if(g_stRun.m_stRunLog.iLogLevel <= ELL_TRACEDETAIL) Log(&g_stRun.m_stRunLog, DATETIME_ACCURACY_S, ELL_TRACE, "%s:%d(%s): " fmt, __FILE__,  __LINE__, __FUNCTION__ , ##__VA_ARGS__);}
//#define TRACELOG(fmt, ...){ if(g_stRun.m_stRunLog.iLogLevel <= ELL_TRACE) Log(&g_stRun.m_stRunLog, DATETIME_ACCURACY_S, ELL_TRACE, "%s:%d(%s): " fmt, __FILE__,  __LINE__, __FUNCTION__ , ##__VA_ARGS__);}
//#define ERRORLOG(fmt, ...){ if(g_stRun.m_stRunLog.iLogLevel <= ELL_ERROR) Log(&g_stRun.m_stRunLog, DATETIME_ACCURACY_S, ELL_ERROR, "%s:%d(%s): " fmt, __FILE__,  __LINE__, __FUNCTION__ , ##__VA_ARGS__);}
//#define T_ERRORLOG(retcode,classname,fmt,...){ if(g_stRun.m_stRunLog.iLogLevel <= ELL_ERROR) Log(&g_stRun.m_stRunLog, DATETIME_ACCURACY_S, ELL_ERROR, "%s:%d(%s):%s Ret:%d " fmt, __FILE__,  __LINE__, __FUNCTION__ , classname, retcode, ##__VA_ARGS__);}
//#define SVR_LOG(level, classname, fmt, ...){if(g_stRun.m_stRunLog.iLogLevel <= level) Log(&g_stRun.m_stRunLog, DATETIME_ACCURACY_S, level, "%s::%s " fmt, #classname, __FUNCTION__ , ##__VA_ARGS__);}
//#define SVR_ERRLOG(classname, fmt, ...){if(g_stRun.m_stRunLog.iLogLevel <= ELL_ERROR) Log(&g_stRun.m_stRunLog, DATETIME_ACCURACY_S, ELL_ERROR, "%s::%s " fmt, #classname, __FUNCTION__ , ##__VA_ARGS__);}
//#define SVR_TRACELOG(classname, fmt, ...){if(g_stRun.m_stRunLog.iLogLevel <= ELL_TRACE) Log(&g_stRun.m_stRunLog, DATETIME_ACCURACY_S, ELL_TRACE, "%s::%s " fmt, #classname, __FUNCTION__ , ##__VA_ARGS__);}
#define GETSTRVER(version , prestr ,major , minor , build)  \
    do{ sprintf(version,"%s %d.%d.%04hd" , prestr , major ,minor , build) ;  }while(0)
#if defined(__TIME__) && defined(__DATE__)
#define GETCOMPILEDATE(date)        \
    do  { sprintf(date , "Last Compiling Date : %s %s" , __DATE__ , __TIME__) ; }while(0)
#else
#define GETCOMPILEDATE(date)        \
    do{ sprintf(date , "Last Compiling Date : Unknow") ; }while(0)
#endif